package com.fay.mymiaosha.validator;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title:
 * @Description:
 * @Author Fay Wang
 * @Date 2022/3/15 19:43
 * @Version 1.0
 */
@Getter
@Setter
public class ValidationResult {
    // check result is wrong or not
    private boolean hasError = false;

    // save error_info into map
    private Map<String, String> errorMsgMap = new HashMap<>();

    // generic get errMsg by converting errMsgMap to string
    // 通过格式化字符串信息获取错误结果
    public String getErrMsg() {
        return StringUtils.join(errorMsgMap.values().toArray(), ",");
    }

}
